var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = getApp().globalData.api;

Page({
    data: {
        isSearch: !1,
        isSearchEnd: !1,
        searchValue: "",
        searchList: [],
        hotHosList: [],
        listData: null
    },
    onLoad: function(a) {
        
    },
 
    loadData: function() {
        this.requestHosData(1);
    },
    requestHosData: function(e) {
        var s = this;
        let searchModel1={
            areacode: getApp().globalData.selectedCityAreaCode,
            clientType: 2,
            lat: getApp().globalData.localLatitude || "",
            lon: getApp().globalData.localLongitude || "",
            oriFutureDate: "",     
            originUnitParam: "",
            oriOrderBy: ""
        }; 
        let para = {
            page: e, 
            keyword: s.data.searchValue,
            searchModel: JSON.stringify(searchModel1)
        };
        t.post1("wechat/home/_listMicroHospital", para, !1).then(function(t) {
            if ("1" == t.code) {
                var e = s.data.listData;
                1 == t.data.pageNum ? (wx.pageScrollTo({
                    scrollTop: 9999,
                    duration: 300
                }), e = t.data) : (e.list = [].concat(a(s.data.listData.list), a(t.data.list)), 
                e.pageNum = t.data.pageNum, e.total = t.data.total), s.setData({
                    isSearch: !0,
                    loadingExit: e.list.length >= t.data.total,
                    listData: e
                });
            }
        }, function(a) {});
    },
    searchValueInput: function(a) {
        var t = a.detail.value;
        t.length > 0 ? (this.setData({
            searchValue: t
        }), this.loadData()) : this.setData({
            searchValue: "",
            isSearch: !1,
            listData: null
        });
    },
    searchTap: function() {
        0 != this.data.searchValue.length && this.loadData();
    },
    searchCleanTap: function() {
        this.setData({
            searchValue: "",
            isSearch: !1,
            listData: null
        });
    },
    hotHospitalTap: function(a) {
        wx.navigateTo({
            url: "/pages/hospitalinfo/hospitalinfo?domain=".concat(a.currentTarget.dataset.item.searchParams.domain, "&areaCode=").concat(a.currentTarget.dataset.item.searchParams.areaCode)
        });
    },
    hospitalDetailTap: function(a) {
        var t = a.currentTarget.dataset.info;
        wx.navigateTo({
            url: "/pages/hospitalinfo/hospitalinfo?domain=".concat(t.domain, "&areaCode=").concat(t.areaCode)
        });
    }
});